package com.caogt.demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/demo")
public class DemoCtrl {

    @Autowired
    private RestTemplate restTemplate;
    @GetMapping("/test")
    public String test(){
        System.out.println("test_current_time:"+System.currentTimeMillis());
        return "success";
    }
    @GetMapping("/hello")
    public String hello(){
        System.out.println("hello_current_time:"+System.currentTimeMillis());
        Map<String,Object> map = new HashMap<>();
        restTemplate.getForObject("http://app/hello",String.class);
        return "success";
    }
}
